#include "sym.h"
const std::map<std::string, SYMS> keysMap = {
    {"const", SYMS::CONST},
    {"var", SYMS::VAR},
    {"begin", SYMS::BEGIN},
    {"end", SYMS::END},
    {"if", SYMS::IF},
    {"then", SYMS::THEN},
    {"while", SYMS::WHILE},
    {"do", SYMS::DO},
    {"read", SYMS::READ},
    {"write", SYMS::WRITE},
    {"else", SYMS::ELSE},
    {"procedure", SYMS::PROCEDURE},
    {"odd", SYMS::ODD},
    {"repeat", SYMS::REPEAT},
    {"until", SYMS::UNTIL},
    {"call", SYMS::CALL}};

SYMS GetKeyByString(std::string s)
{
    auto it = keysMap.find(s);
    if (it != keysMap.end())
    {
        return it->second;
    }
    else
    {
        return SYMS::NILL;
    }
}
bool checkKey(std::string s)
{
    SYMS tmp = GetKeyByString(s);
    if (tmp != SYMS::NILL)
    {
        SYM = tmp;
        return true;
    }
    else
        return false;
}